<!DOCTYPE html>
<html>
<head>
    <title>职统</title>
    <link rel="stylesheet" href="/styles/common.css"/>
    <script type="text/javascript" src="/styles/js/jquery-1.7.2.js"></script>

</head>
<body>
<#include "top.ftl">
<div class="page-body">
    <#include "leftmenu.ftl">
    <div class="page-content">
        <div class="content-nav">
            考勤管理 > 考勤
        </div>
        <table class="listtable">
            <caption>所有部门:</caption>
            <tr class="listheader">
                <th>姓名</th>
                <th>账号</th>
                <th>修改状态</th>
                <th>操作</th>

            </tr>
            <#if employee??>
                <#list employee as emp>
                    <tr>
                        <td>${emp.employeename}</td>
                        <td>${emp.username}</td>
                        <td>
                            <select id="edit${emp.employeeid}">
                                <#list adsence as ad>
                                    <option value="${ad.absenceid}">${ad.content}</option>
                                </#list>
                            </select>
                        </td>
                        <td>
                            <input id="employeename" value="${emp.employeename}" hidden>
                            <input id="departmentid" value="${emp.departmentid}" hidden>
                            <button onclick="insertsql(${emp.employeeid})">提交</button>
                        </td>
                    </tr>
                </#list>
            </#if>
        </table>
        <div style="color: red" id="error"></div>
    </div>
</div>
<div class="page-footer">
    <hr/>

</div>

<script>
    function insertsql(employeeid) {
        var error = $("#error")
        var optionid = $("#edit"+employeeid).val();
        var employeename = $("#employeename").val();
        var departmentid = $("#departmentid").val();
        $.post("/checkworkget",{employeename:employeename,employeeid:employeeid,departmentid:departmentid,status:optionid},function (msg) {
            if(msg == 'success'){
                console.log("记录成功~");
                error.text("操作成功");
            }else{
                console.log("失败");
                error.text("操作失败")
            }

        })
    }
</script>
</body>
</html>